<template>
	<view class="u-page u-bg-white" :style="skin">
		<zx-nav title="订单支付" bg="#fff" fixedTop noBack></zx-nav>
		<view>
			<view class="imgbox"><image :src="`${assetsPath}/${state==1 ? 'success' : 'error'}.png`" mode="widthFix"></image></view>
			<view class="tip">{{ state==1 ? '支付成功，将为您尽快配送产品～' : '支付失败，请重新支付～' }}</view>
		</view>
		<view class="btnbar">
			<view class="btn-success">
				<u-button @click="navTo('order')" type="success" shape="circle" class="u-reset-button">{{ state==1 ? '完成' : '重新支付' }}</u-button>
			</view>
			<view class="btn-success">
				<u-button @click="navTo(state==1?'home':'order')" type="success" shape="circle" :plain="true" class="u-reset-button ">{{ state==1 ? '返回首页' : '返回订单' }}</u-button>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			state: 0 //1 支付成功 0 支付失败
		};
	},
	onLoad(options) {
		this.state = options.state;
	},
	methods: {
		navTo(type) {
			if (type == 'home') {
				this.$Router.pushTab({
					path: '/pages/index/index'
				});
			} else {
				this.$Router.replace({
					path: '/pages/order/list?tabindex=0'
				});
			}
		}
	}
};
</script>

<style lang="scss">
.imgbox {
	padding-top: 170upx;
	margin-bottom: 17upx;
	image {
		display: block;
		width: 190upx;
		height: 190upx;
		margin: 0 auto;
	}
}
.tip {
	text-align: center;
	color: $u-main-color;
}
.btnbar {
	width: 576upx;
	margin: 83upx auto 0;
	.btn-success + .btn-success {
		margin-top: 44upx;
	}
}
</style>
